<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />

	<title>Class: MessageRule</title>

	<link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />

	<script src="./js/jquery.js" type="text/javascript"
		charset="utf-8"></script>
	<script src="./js/thickbox-compressed.js" type="text/javascript"
		charset="utf-8"></script>
	<script src="./js/quicksearch.js" type="text/javascript"
		charset="utf-8"></script>
	<script src="./js/darkfish.js" type="text/javascript"
		charset="utf-8"></script>

</head>
<body class="class">

	<div id="metadata">
		<div id="home-metadata">
			<div id="home-section" class="section">
        <h3 class="section-header">
          <a href="./index.html">Home</a>
          <a href="./index.html#classes">Classes</a>
          <a href="./index.html#methods">Methods</a>
        </h3>
			</div>
		</div>

		<div id="file-metadata">
			<div id="file-list-section" class="section">
				<h3 class="section-header">In Files</h3>
				<div class="section-body">
					<ul>
					
						<li><a href="./app/models/message_rule_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
							class="thickbox" title="app/models/message_rule.rb">app/models/message_rule.rb</a></li>
					
					</ul>
				</div>
			</div>

			
		</div>

		<div id="class-metadata">

			<!-- Parent Class -->
			
			<div id="parent-class-section" class="section">
				<h3 class="section-header">Parent</h3>
				
				<p class="link">ActiveRecord::Base</p>
				
			</div>
			

			<!-- Namespace Contents -->
			

			<!-- Method Quickref -->
			
			<div id="method-list-section" class="section">
				<h3 class="section-header">Methods</h3>
				<ul class="link-list">
					
					<li><a href="#method-c-rule_types">::rule_types</a></li>
					
					<li><a href="#method-c-target_columns">::target_columns</a></li>
					
					<li><a href="#method-i-execute_rule">#execute_rule</a></li>
					
				</ul>
			</div>
			

			<!-- Included Modules -->
			
		</div>

		<div id="project-metadata">
			
			
			<div id="fileindex-section" class="section project-section">
				<h3 class="section-header">Files</h3>
				<ul>
				
					<li class="file"><a href="./doc/README_FOR_APP.html">README_FOR_APP</a></li>
				
				</ul>
			</div>
			

			<div id="classindex-section" class="section project-section">
				<h3 class="section-header">Class Index
					<span class="search-toggle"><img src="./images/find.png"
						height="16" width="16" alt="[+]"
						title="show/hide quicksearch" /></span></h3>
				<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
				<fieldset>
					<legend>Quicksearch</legend>
					<input type="text" name="quicksearch" value=""
						class="quicksearch-field" />
				</fieldset>
				</form>

				<ul class="link-list">
				
					<li><a href="./Portal.html">Portal</a></li>
				
					<li><a href="./Portal/FriendsController.html">Portal::FriendsController</a></li>
				
					<li><a href="./Portal/FriendsHelper.html">Portal::FriendsHelper</a></li>
				
					<li><a href="./Portal/MessageAttachmentsController.html">Portal::MessageAttachmentsController</a></li>
				
					<li><a href="./Portal/MessageAttachmentsHelper.html">Portal::MessageAttachmentsHelper</a></li>
				
					<li><a href="./Portal/MessageDestinationsController.html">Portal::MessageDestinationsController</a></li>
				
					<li><a href="./Portal/MessageDestinationsHelper.html">Portal::MessageDestinationsHelper</a></li>
				
					<li><a href="./Portal/MessageFoldersController.html">Portal::MessageFoldersController</a></li>
				
					<li><a href="./Portal/MessageFoldersHelper.html">Portal::MessageFoldersHelper</a></li>
				
					<li><a href="./Portal/MessageOutboxController.html">Portal::MessageOutboxController</a></li>
				
					<li><a href="./Portal/MessageOutboxHelper.html">Portal::MessageOutboxHelper</a></li>
				
					<li><a href="./Portal/MessageRulesController.html">Portal::MessageRulesController</a></li>
				
					<li><a href="./Portal/MessageRulesHelper.html">Portal::MessageRulesHelper</a></li>
				
					<li><a href="./Portal/MessagesController.html">Portal::MessagesController</a></li>
				
					<li><a href="./Portal/MessagesHelper.html">Portal::MessagesHelper</a></li>
				
					<li><a href="./Portal/ProfilesController.html">Portal::ProfilesController</a></li>
				
					<li><a href="./Portal/ProfilesHelper.html">Portal::ProfilesHelper</a></li>
				
					<li><a href="./Portal/TopController.html">Portal::TopController</a></li>
				
					<li><a href="./Portal/TopHelper.html">Portal::TopHelper</a></li>
				
					<li><a href="./Common.html">Common</a></li>
				
					<li><a href="./Common/InvitesController.html">Common::InvitesController</a></li>
				
					<li><a href="./Common/InvitesHelper.html">Common::InvitesHelper</a></li>
				
					<li><a href="./Common/SettingsController.html">Common::SettingsController</a></li>
				
					<li><a href="./Common/SettingsHelper.html">Common::SettingsHelper</a></li>
				
					<li><a href="./Common/UserSessionsController.html">Common::UserSessionsController</a></li>
				
					<li><a href="./Common/UserSessionsHelper.html">Common::UserSessionsHelper</a></li>
				
					<li><a href="./Common/UsersController.html">Common::UsersController</a></li>
				
					<li><a href="./Common/UsersHelper.html">Common::UsersHelper</a></li>
				
					<li><a href="./Admin.html">Admin</a></li>
				
					<li><a href="./Admin/AdminController.html">Admin::AdminController</a></li>
				
					<li><a href="./Admin/GlobalSettingsController.html">Admin::GlobalSettingsController</a></li>
				
					<li><a href="./Admin/GlobalSettingsHelper.html">Admin::GlobalSettingsHelper</a></li>
				
					<li><a href="./Admin/SystemMessagesController.html">Admin::SystemMessagesController</a></li>
				
					<li><a href="./Admin/SystemMessagesHelper.html">Admin::SystemMessagesHelper</a></li>
				
					<li><a href="./Admin/UsersController.html">Admin::UsersController</a></li>
				
					<li><a href="./Admin/UsersHelper.html">Admin::UsersHelper</a></li>
				
					<li><a href="./Mobile.html">Mobile</a></li>
				
					<li><a href="./Mobile/EmoticonHelper.html">Mobile::EmoticonHelper</a></li>
				
					<li><a href="./Mobile/LinkRenderer.html">Mobile::LinkRenderer</a></li>
				
					<li><a href="./ApplicationController.html">ApplicationController</a></li>
				
					<li><a href="./ApplicationHelper.html">ApplicationHelper</a></li>
				
					<li><a href="./AvatarUploader.html">AvatarUploader</a></li>
				
					<li><a href="./BlogAttachmentUploader.html">BlogAttachmentUploader</a></li>
				
					<li><a href="./BoardMessageAttachmentUploader.html">BoardMessageAttachmentUploader</a></li>
				
					<li><a href="./CarrierWaveExtension.html">CarrierWaveExtension</a></li>
				
					<li><a href="./CommonUtils.html">CommonUtils</a></li>
				
					<li><a href="./CommunityAvatarUploader.html">CommunityAvatarUploader</a></li>
				
					<li><a href="./Friend.html">Friend</a></li>
				
					<li><a href="./FriendRequest.html">FriendRequest</a></li>
				
					<li><a href="./GlobalSetting.html">GlobalSetting</a></li>
				
					<li><a href="./Invite.html">Invite</a></li>
				
					<li><a href="./Message.html">Message</a></li>
				
					<li><a href="./MessageAttachment.html">MessageAttachment</a></li>
				
					<li><a href="./MessageAttachmentUploader.html">MessageAttachmentUploader</a></li>
				
					<li><a href="./MessageFolder.html">MessageFolder</a></li>
				
					<li><a href="./MessageRecipient.html">MessageRecipient</a></li>
				
					<li><a href="./MessageRule.html">MessageRule</a></li>
				
					<li><a href="./Profile.html">Profile</a></li>
				
					<li><a href="./Role.html">Role</a></li>
				
					<li><a href="./Setting.html">Setting</a></li>
				
					<li><a href="./SnsMailer.html">SnsMailer</a></li>
				
					<li><a href="./SystemMessage.html">SystemMessage</a></li>
				
					<li><a href="./User.html">User</a></li>
				
					<li><a href="./UserSession.html">UserSession</a></li>
				
				</ul>
				<div id="no-class-search-results" style="display: none;">No matching classes.</div>
			</div>

			
		</div>
	</div>

	<div id="documentation">
		<h1 class="class">MessageRule</h1>

		<div id="description">
			<h3>メッセージの振り分けルールの管理用モデル</h3>

		</div>

		<!-- Constants -->
		

		<!-- Attributes -->
		

		<!-- Methods -->
		
		<div id="public-class-method-details" class="method-section section">
			<h3 class="section-header">Public Class Methods</h3>

		
			<div id="rule-types-method" class="method-detail ">
				<a name="method-c-rule_types"></a>

				<div class="method-heading">
				
					<span class="method-name">rule_types</span><span
						class="method-args">()</span>
					<span class="method-click-advice">click to toggle source</span>
				
				</div>

				<div class="method-description">
					
					<h3>振り分けルールの種別一覧を配列で返す</h3>
					

					
					<div class="method-source-code"
						id="rule-types-source">
<pre>
    <span class="ruby-comment cmt"># File app/models/message_rule.rb, line 32</span>
32:   <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">rule_types</span>
33:     <span class="ruby-keyword kw">return</span> [[<span class="ruby-constant">I18n</span>.<span class="ruby-identifier">t</span>(<span class="ruby-value str">&quot;sns.message_rule_types.full&quot;</span>), <span class="ruby-value str">&quot;full&quot;</span>],
34:             [<span class="ruby-constant">I18n</span>.<span class="ruby-identifier">t</span>(<span class="ruby-value str">&quot;sns.message_rule_types.regexp&quot;</span>), <span class="ruby-value str">&quot;regexp&quot;</span>]]
35:   <span class="ruby-keyword kw">end</span></pre>
					</div>
					
				</div>

				

				
			</div>

		
			<div id="target-columns-method" class="method-detail ">
				<a name="method-c-target_columns"></a>

				<div class="method-heading">
				
					<span class="method-name">target_columns</span><span
						class="method-args">()</span>
					<span class="method-click-advice">click to toggle source</span>
				
				</div>

				<div class="method-description">
					
					<h3>振り分け基準に使えるカラムの一覧を配列で返す</h3>
					

					
					<div class="method-source-code"
						id="target-columns-source">
<pre>
    <span class="ruby-comment cmt"># File app/models/message_rule.rb, line 24</span>
24:   <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">target_columns</span>
25:     <span class="ruby-keyword kw">return</span> [[<span class="ruby-constant">I18n</span>.<span class="ruby-identifier">t</span>(<span class="ruby-value str">&quot;sns.message_filter_targets.subject&quot;</span>), <span class="ruby-value str">&quot;subject&quot;</span>],
26:             [<span class="ruby-constant">I18n</span>.<span class="ruby-identifier">t</span>(<span class="ruby-value str">&quot;sns.message_filter_targets.to_addr&quot;</span>), <span class="ruby-value str">&quot;to_addrs&quot;</span>],
27:             [<span class="ruby-constant">I18n</span>.<span class="ruby-identifier">t</span>(<span class="ruby-value str">&quot;sns.message_filter_targets.cc_addr&quot;</span>), <span class="ruby-value str">&quot;cc_addrs&quot;</span>],
28:             [<span class="ruby-constant">I18n</span>.<span class="ruby-identifier">t</span>(<span class="ruby-value str">&quot;sns.message_filter_targets.body&quot;</span>),    <span class="ruby-value str">&quot;body&quot;</span>]]
29:   <span class="ruby-keyword kw">end</span></pre>
					</div>
					
				</div>

				

				
			</div>

		
		</div>
	
		<div id="public-instance-method-details" class="method-section section">
			<h3 class="section-header">Public Instance Methods</h3>

		
			<div id="execute-rule-method" class="method-detail ">
				<a name="method-i-execute_rule"></a>

				<div class="method-heading">
				
					<span class="method-name">execute_rule</span><span
						class="method-args">(message)</span>
					<span class="method-click-advice">click to toggle source</span>
				
				</div>

				<div class="method-description">
					
					<h3>振り分けルールに従って引数で指定されたメッセージを振り分ける</h3>
					

					
					<div class="method-source-code"
						id="execute-rule-source">
<pre>
    <span class="ruby-comment cmt"># File app/models/message_rule.rb, line 9</span>
 9:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">execute_rule</span>(<span class="ruby-identifier">message</span>)
10:     <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Invalid method called.&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">target_columns</span>.<span class="ruby-identifier">collect</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">pair</span><span class="ruby-operator">|</span> <span class="ruby-identifier">pair</span>[<span class="ruby-value">1</span>]}.<span class="ruby-identifier">include?</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">target_column</span>)
11:     <span class="ruby-keyword kw">case</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">rule_type</span>
12:     <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;full&quot;</span>
13:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">message</span>.<span class="ruby-identifier">__send__</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">target_column</span>) <span class="ruby-operator">==</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">rule_value</span>
14:         <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">message_folder</span>.<span class="ruby-identifier">messages</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">message</span>
15:       <span class="ruby-keyword kw">end</span>
16:     <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;regexp&quot;</span>
17:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">message</span>.<span class="ruby-identifier">__send__</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">target_column</span>) <span class="ruby-operator">=~</span> <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">rule_value</span>)
18:         <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">message_folder</span>.<span class="ruby-identifier">messages</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">message</span>
19:       <span class="ruby-keyword kw">end</span>
20:     <span class="ruby-keyword kw">end</span>
21:   <span class="ruby-keyword kw">end</span></pre>
					</div>
					
				</div>

				

				
			</div>

		
		</div>
	

	</div>


	<div id="rdoc-debugging-section-dump" class="debugging-section">
	
		<p>Disabled; run with --debug to generate this.</p>
	
	</div>

	<div id="validator-badges">
		<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
		<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
			Rdoc Generator</a> 1.1.6</small>.</p>
	</div>

</body>
</html>

